package short_semester.questionnaire_planet.controller;

import org.springframework.web.bind.MissingRequestValueException;
import org.springframework.web.bind.MissingServletRequestParameterException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import short_semester.questionnaire_planet.response.CommonResponse;

@RestControllerAdvice
public class ExceptionController {
    
    @ExceptionHandler(MissingRequestValueException.class)
    public CommonResponse RestParamExceptionHandler(Exception e){
        CommonResponse response = new CommonResponse();
        response.error(e.getMessage());
        return response;
    }
}
